package com.job.kujiale;

import java.util.Arrays;

/**
 * <p>
 *
 * </p>
 *
 * @author 12071
 * @date 2022/10/10 16:06
 */
public class A1 {
    public static void main(String[] args) {
        int[] arr1 = new int[]{1,3,5,7,9};
        int[] arr2 = new int[]{2,4,6,8,10};

        int len1 = arr1.length;
        int len2 = arr2.length;
        int[] res = new int[len1+len2];

        int i=0,j=0,index=0;
        while (i<len1 && j<len2){
            if(arr1[i]<arr2[j]){
                res[index] = arr1[i++];
            }else{
                res[index] = arr2[j++];
            }
            index++;
        }
        while (i<len1){
            res[index++] = arr1[i++];
        }
        while(j<len2){
            res[index++] = arr2[j++];
        }

        System.out.println(Arrays.toString(res));
    }


}
